package top.dbpanda.cmsjpa.learn.nio.remote;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * @author 20018954
 */
public class MyServer {
    public static void main(String[] args) throws IOException {
        //服务的地址：127.0.0.1:8888
        ServerSocket serverSocket = new ServerSocket(8888);
        //允许接收多个客户端发来连接
        while (true){
            //一直阻塞 直到有客户端发来连接
            Socket accept = serverSocket.accept();
            //创建一个线程 用于给该客户端发送一个文件
            new Thread(new SendFile(accept)).start();
        }
    }
}
